﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:26 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using WHMS;
using WHMS.FactoryClasses;
using WHMS.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace WHMS.RelationClasses
{
	/// <summary>Implements the relations factory for the entity: Project. </summary>
	public partial class ProjectRelations
	{
		/// <summary>CTor</summary>
		public ProjectRelations()
		{
		}

		/// <summary>Gets all relations of the ProjectEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.InitialBalanceEntityUsingProjectId);
			toReturn.Add(this.ProjectContractorEntityUsingProjectId);
			toReturn.Add(this.ProjectItemPlanEntityUsingProjectId);
			toReturn.Add(this.StoreEntityUsingProjectId);
			toReturn.Add(this.StoreShelfBalanceEntityUsingProjectId);
			toReturn.Add(this.SupplyOrderEntityUsingProjectId);
			toReturn.Add(this.TransactionEntityUsingProjectId);
			toReturn.Add(this.TransferRequestEntityUsingProjectId);
			toReturn.Add(this.TransferRequestEntityUsingToProjectId);
			toReturn.Add(this.WithdrawRequestEntityUsingProjectId);
			toReturn.Add(this.UserEntityUsingManagerId);
			return toReturn;
		}

		#region Class Property Declarations

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and InitialBalanceEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - InitialBalance.ProjectId
		/// </summary>
		public virtual IEntityRelation InitialBalanceEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "InitialBalances" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, InitialBalanceFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("InitialBalanceEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and ProjectContractorEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - ProjectContractor.ProjectId
		/// </summary>
		public virtual IEntityRelation ProjectContractorEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "ProjectContractors" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, ProjectContractorFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectContractorEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and ProjectItemPlanEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - ProjectItemPlan.ProjectId
		/// </summary>
		public virtual IEntityRelation ProjectItemPlanEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "ProjectItemPlans" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, ProjectItemPlanFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectItemPlanEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and StoreEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - Store.ProjectId
		/// </summary>
		public virtual IEntityRelation StoreEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "Stores" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, StoreFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and StoreShelfBalanceEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - StoreShelfBalance.ProjectId
		/// </summary>
		public virtual IEntityRelation StoreShelfBalanceEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "StoreShelfBalances" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, StoreShelfBalanceFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("StoreShelfBalanceEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and SupplyOrderEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - SupplyOrder.ProjectId
		/// </summary>
		public virtual IEntityRelation SupplyOrderEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "SupplyOrders" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, SupplyOrderFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("SupplyOrderEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and TransactionEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - Transaction.ProjectId
		/// </summary>
		public virtual IEntityRelation TransactionEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "Transactions" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, TransactionFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransactionEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and TransferRequestEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - TransferRequest.ProjectId
		/// </summary>
		public virtual IEntityRelation TransferRequestEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransferRequests" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, TransferRequestFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransferRequestEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and TransferRequestEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - TransferRequest.ToProjectId
		/// </summary>
		public virtual IEntityRelation TransferRequestEntityUsingToProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "TransferRequests_" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, TransferRequestFields.ToProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("TransferRequestEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and WithdrawRequestEntity over the 1:n relation they have, using the relation between the fields:
		/// Project.Id - WithdrawRequest.ProjectId
		/// </summary>
		public virtual IEntityRelation WithdrawRequestEntityUsingProjectId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "WithdrawRequests" , true);
				relation.AddEntityFieldPair(ProjectFields.Id, WithdrawRequestFields.ProjectId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("WithdrawRequestEntity", false);
				return relation;
			}
		}


		/// <summary>Returns a new IEntityRelation object, between ProjectEntity and UserEntity over the m:1 relation they have, using the relation between the fields:
		/// Project.ManagerId - User.Id
		/// </summary>
		public virtual IEntityRelation UserEntityUsingManagerId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "User", false);
				relation.AddEntityFieldPair(UserFields.Id, ProjectFields.ManagerId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("UserEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ProjectEntity", true);
				return relation;
			}
		}
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}
		#endregion

		#region Included Code

		#endregion
	}
	
	/// <summary>Static class which is used for providing relationship instances which are re-used internally for syncing</summary>
	internal static class StaticProjectRelations
	{
		internal static readonly IEntityRelation InitialBalanceEntityUsingProjectIdStatic = new ProjectRelations().InitialBalanceEntityUsingProjectId;
		internal static readonly IEntityRelation ProjectContractorEntityUsingProjectIdStatic = new ProjectRelations().ProjectContractorEntityUsingProjectId;
		internal static readonly IEntityRelation ProjectItemPlanEntityUsingProjectIdStatic = new ProjectRelations().ProjectItemPlanEntityUsingProjectId;
		internal static readonly IEntityRelation StoreEntityUsingProjectIdStatic = new ProjectRelations().StoreEntityUsingProjectId;
		internal static readonly IEntityRelation StoreShelfBalanceEntityUsingProjectIdStatic = new ProjectRelations().StoreShelfBalanceEntityUsingProjectId;
		internal static readonly IEntityRelation SupplyOrderEntityUsingProjectIdStatic = new ProjectRelations().SupplyOrderEntityUsingProjectId;
		internal static readonly IEntityRelation TransactionEntityUsingProjectIdStatic = new ProjectRelations().TransactionEntityUsingProjectId;
		internal static readonly IEntityRelation TransferRequestEntityUsingProjectIdStatic = new ProjectRelations().TransferRequestEntityUsingProjectId;
		internal static readonly IEntityRelation TransferRequestEntityUsingToProjectIdStatic = new ProjectRelations().TransferRequestEntityUsingToProjectId;
		internal static readonly IEntityRelation WithdrawRequestEntityUsingProjectIdStatic = new ProjectRelations().WithdrawRequestEntityUsingProjectId;
		internal static readonly IEntityRelation UserEntityUsingManagerIdStatic = new ProjectRelations().UserEntityUsingManagerId;

		/// <summary>CTor</summary>
		static StaticProjectRelations()
		{
		}
	}
}
